/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ADDEstagios.java
 *
 * Created on 28/01/2012, 11:10:28
 */
package Formularios;

import Atributos.EstagiosTabela;
import Atributos.Serie;
import Metodos.MinimizaTela;
import Metodos.ObjetoMet;
import Metodos.SerieMet;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

/**
 *
 * @author André
 */
public class ADDEstagios extends javax.swing.JFrame {
    ObjetoMet objmet= new ObjetoMet();
    SerieMet seriemet = new SerieMet();
    static int i;
  MinimizaTela tela= new MinimizaTela(); 
    private String turnoA,turnoB,turnoC,turnoD,turnoE,turnoF,turnoG,turnoH;
    static String SerieA1="",SerieA2="",SerieA3="",SerieB1="",SerieB2="",SerieB3="",SerieC1="",SerieC2="",SerieC3="",SerieD1,SerieD2,SerieD3,SerieE1,SerieE2,SerieE3,SerieF1,SerieF2,SerieF3= "";
      static int Serieturma;
      private List<Serie> listaserie;
      private String [] nome_turma;
    public ADDEstagios() {
        initComponents();
        BufferedImage image=null;
        File imageFile=new File(".\\src\\Imagens\\logo3.png");
        try {
            image=ImageIO.read(imageFile);
            
        } catch (IOException ex) {
        }
        this.setIconImage(image);
        
         i=0;
        Desabilita();
         SerieTurma();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        buttonGroup4 = new javax.swing.ButtonGroup();
        buttonGroup5 = new javax.swing.ButtonGroup();
        buttonGroup6 = new javax.swing.ButtonGroup();
        buttonGroup7 = new javax.swing.ButtonGroup();
        buttonGroup8 = new javax.swing.ButtonGroup();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jPanel1 = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        jl_serie = new javax.swing.JLabel();
        jl_serie1 = new javax.swing.JLabel();
        jl_serie2 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        serieEE = new javax.swing.JTextField();
        jSeparator5 = new javax.swing.JSeparator();
        serieextra = new javax.swing.JTextField();
        RB_manhaE = new javax.swing.JRadioButton();
        RB_tardeE = new javax.swing.JRadioButton();
        jSeparator3 = new javax.swing.JSeparator();
        serieFF = new javax.swing.JTextField();
        RB_manhaF = new javax.swing.JRadioButton();
        RB_tardeF = new javax.swing.JRadioButton();
        jSeparator4 = new javax.swing.JSeparator();
        RB_manhaG = new javax.swing.JRadioButton();
        RB_tardeG = new javax.swing.JRadioButton();
        serieGG = new javax.swing.JTextField();
        jSeparator6 = new javax.swing.JSeparator();
        jSeparator7 = new javax.swing.JSeparator();
        RB_tardeH = new javax.swing.JRadioButton();
        RB_manhaH = new javax.swing.JRadioButton();
        serieHH = new javax.swing.JTextField();
        RB_manhaA = new javax.swing.JRadioButton();
        RB_tardeA = new javax.swing.JRadioButton();
        serieAA = new javax.swing.JTextField();
        jSeparator8 = new javax.swing.JSeparator();
        jSeparator9 = new javax.swing.JSeparator();
        RB_tardeB = new javax.swing.JRadioButton();
        RB_manhaB = new javax.swing.JRadioButton();
        serieBB = new javax.swing.JTextField();
        RB_manhaC = new javax.swing.JRadioButton();
        RB_tardeC = new javax.swing.JRadioButton();
        serieCC = new javax.swing.JTextField();
        jSeparator10 = new javax.swing.JSeparator();
        jSeparator11 = new javax.swing.JSeparator();
        RB_tardeD = new javax.swing.JRadioButton();
        RB_manhaD = new javax.swing.JRadioButton();
        serieDD = new javax.swing.JTextField();
        jB_cadastrar = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Adiciona Estagios");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(0, 0, 0));
        jPanel1.setLayout(null);

        jSeparator1.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator1.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator1.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator1);
        jSeparator1.setBounds(120, 460, 220, 10);

        jl_serie.setBackground(new java.awt.Color(0, 0, 0));
        jl_serie.setFont(new java.awt.Font("D3 Euronism italic", 1, 18)); // NOI18N
        jl_serie.setForeground(new java.awt.Color(255, 255, 255));
        jl_serie.setText("Serie");
        jPanel1.add(jl_serie);
        jl_serie.setBounds(110, 60, 90, 30);

        jl_serie1.setBackground(new java.awt.Color(0, 0, 0));
        jl_serie1.setFont(new java.awt.Font("D3 Euronism italic", 1, 18)); // NOI18N
        jl_serie1.setForeground(new java.awt.Color(255, 255, 255));
        jl_serie1.setText("Turma");
        jPanel1.add(jl_serie1);
        jl_serie1.setBounds(10, 160, 100, 30);

        jl_serie2.setBackground(new java.awt.Color(0, 0, 0));
        jl_serie2.setFont(new java.awt.Font("D3 Euronism italic", 1, 18)); // NOI18N
        jl_serie2.setForeground(new java.awt.Color(255, 255, 255));
        jl_serie2.setText("Quais turnos as turmas encontra-se em Estagio?");
        jPanel1.add(jl_serie2);
        jl_serie2.setBounds(10, 20, 720, 30);

        jSeparator2.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator2.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jSeparator2.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator2);
        jSeparator2.setBounds(100, 80, 11, 490);

        serieEE.setBackground(new java.awt.Color(0, 0, 0));
        serieEE.setEditable(false);
        serieEE.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieEE.setForeground(new java.awt.Color(255, 255, 255));
        serieEE.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieEE.setText("E");
        serieEE.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieEE.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieEE);
        serieEE.setBounds(150, 400, 40, 40);

        jSeparator5.setForeground(new java.awt.Color(0, 0, 0));
        jPanel1.add(jSeparator5);
        jSeparator5.setBounds(210, 250, 0, 2);

        serieextra.setBackground(new java.awt.Color(0, 0, 0));
        serieextra.setEditable(false);
        serieextra.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieextra.setForeground(new java.awt.Color(255, 255, 255));
        serieextra.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieextra.setText("3");
        serieextra.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieextra.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieextra);
        serieextra.setBounds(140, 101, 60, 40);

        RB_manhaE.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup5.add(RB_manhaE);
        RB_manhaE.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaE.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaE.setText("Manhã");
        RB_manhaE.setFocusPainted(false);
        RB_manhaE.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaEItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaE);
        RB_manhaE.setBounds(220, 380, 80, 34);

        RB_tardeE.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup5.add(RB_tardeE);
        RB_tardeE.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeE.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeE.setText("Tarde");
        RB_tardeE.setFocusPainted(false);
        RB_tardeE.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeEItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeE);
        RB_tardeE.setBounds(220, 420, 78, 34);

        jSeparator3.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator3.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator3.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator3);
        jSeparator3.setBounds(10, 150, 640, 10);

        serieFF.setBackground(new java.awt.Color(0, 0, 0));
        serieFF.setEditable(false);
        serieFF.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieFF.setForeground(new java.awt.Color(255, 255, 255));
        serieFF.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieFF.setText("F");
        serieFF.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieFF.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieFF);
        serieFF.setBounds(450, 400, 40, 40);

        RB_manhaF.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup6.add(RB_manhaF);
        RB_manhaF.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaF.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaF.setText("Manhã");
        RB_manhaF.setFocusPainted(false);
        RB_manhaF.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaFItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaF);
        RB_manhaF.setBounds(520, 380, 80, 34);

        RB_tardeF.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup6.add(RB_tardeF);
        RB_tardeF.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeF.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeF.setText("Tarde");
        RB_tardeF.setFocusPainted(false);
        RB_tardeF.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeFItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeF);
        RB_tardeF.setBounds(520, 420, 78, 34);

        jSeparator4.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator4.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator4.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator4);
        jSeparator4.setBounds(420, 460, 220, 10);

        RB_manhaG.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup7.add(RB_manhaG);
        RB_manhaG.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaG.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaG.setText("Manhã");
        RB_manhaG.setFocusPainted(false);
        RB_manhaG.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaGItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaG);
        RB_manhaG.setBounds(220, 480, 80, 34);

        RB_tardeG.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup7.add(RB_tardeG);
        RB_tardeG.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeG.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeG.setText("Tarde");
        RB_tardeG.setFocusPainted(false);
        RB_tardeG.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeGItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeG);
        RB_tardeG.setBounds(220, 520, 78, 34);

        serieGG.setBackground(new java.awt.Color(0, 0, 0));
        serieGG.setEditable(false);
        serieGG.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieGG.setForeground(new java.awt.Color(255, 255, 255));
        serieGG.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieGG.setText("G");
        serieGG.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieGG.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieGG);
        serieGG.setBounds(150, 500, 40, 40);

        jSeparator6.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator6.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator6.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator6);
        jSeparator6.setBounds(120, 560, 220, 10);

        jSeparator7.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator7.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator7.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator7);
        jSeparator7.setBounds(420, 560, 220, 10);

        RB_tardeH.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup8.add(RB_tardeH);
        RB_tardeH.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeH.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeH.setText("Tarde");
        RB_tardeH.setFocusPainted(false);
        RB_tardeH.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeHItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeH);
        RB_tardeH.setBounds(520, 520, 78, 34);

        RB_manhaH.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup8.add(RB_manhaH);
        RB_manhaH.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaH.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaH.setText("Manhã");
        RB_manhaH.setFocusPainted(false);
        RB_manhaH.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaHItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaH);
        RB_manhaH.setBounds(520, 480, 80, 34);

        serieHH.setBackground(new java.awt.Color(0, 0, 0));
        serieHH.setEditable(false);
        serieHH.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieHH.setForeground(new java.awt.Color(255, 255, 255));
        serieHH.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieHH.setText("H");
        serieHH.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieHH.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieHH);
        serieHH.setBounds(450, 500, 40, 40);

        RB_manhaA.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup1.add(RB_manhaA);
        RB_manhaA.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaA.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaA.setText("Manhã");
        RB_manhaA.setFocusPainted(false);
        RB_manhaA.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaAItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaA);
        RB_manhaA.setBounds(220, 160, 80, 34);

        RB_tardeA.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup1.add(RB_tardeA);
        RB_tardeA.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeA.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeA.setText("Tarde");
        RB_tardeA.setFocusPainted(false);
        RB_tardeA.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeAItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeA);
        RB_tardeA.setBounds(220, 200, 78, 34);

        serieAA.setBackground(new java.awt.Color(0, 0, 0));
        serieAA.setEditable(false);
        serieAA.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieAA.setForeground(new java.awt.Color(255, 255, 255));
        serieAA.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieAA.setText("A");
        serieAA.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieAA.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieAA);
        serieAA.setBounds(150, 180, 40, 40);

        jSeparator8.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator8.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator8.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator8);
        jSeparator8.setBounds(120, 240, 220, 10);

        jSeparator9.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator9.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator9.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator9);
        jSeparator9.setBounds(420, 240, 220, 10);

        RB_tardeB.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup2.add(RB_tardeB);
        RB_tardeB.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeB.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeB.setText("Tarde");
        RB_tardeB.setFocusPainted(false);
        RB_tardeB.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeBItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeB);
        RB_tardeB.setBounds(520, 200, 78, 34);

        RB_manhaB.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup2.add(RB_manhaB);
        RB_manhaB.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaB.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaB.setText("Manhã");
        RB_manhaB.setFocusPainted(false);
        RB_manhaB.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaBItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaB);
        RB_manhaB.setBounds(520, 160, 80, 34);

        serieBB.setBackground(new java.awt.Color(0, 0, 0));
        serieBB.setEditable(false);
        serieBB.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieBB.setForeground(new java.awt.Color(255, 255, 255));
        serieBB.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieBB.setText("B");
        serieBB.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieBB.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieBB);
        serieBB.setBounds(450, 180, 40, 40);

        RB_manhaC.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup3.add(RB_manhaC);
        RB_manhaC.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaC.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaC.setText("Manhã");
        RB_manhaC.setFocusPainted(false);
        RB_manhaC.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaCItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaC);
        RB_manhaC.setBounds(220, 270, 80, 34);

        RB_tardeC.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup3.add(RB_tardeC);
        RB_tardeC.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeC.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeC.setText("Tarde");
        RB_tardeC.setFocusPainted(false);
        RB_tardeC.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeCItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeC);
        RB_tardeC.setBounds(220, 310, 78, 34);

        serieCC.setBackground(new java.awt.Color(0, 0, 0));
        serieCC.setEditable(false);
        serieCC.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieCC.setForeground(new java.awt.Color(255, 255, 255));
        serieCC.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieCC.setText("C");
        serieCC.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieCC.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieCC);
        serieCC.setBounds(150, 290, 40, 40);

        jSeparator10.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator10.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator10.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator10);
        jSeparator10.setBounds(120, 350, 220, 10);

        jSeparator11.setBackground(new java.awt.Color(255, 153, 0));
        jSeparator11.setForeground(new java.awt.Color(0, 0, 0));
        jSeparator11.setPreferredSize(new java.awt.Dimension(3, 0));
        jPanel1.add(jSeparator11);
        jSeparator11.setBounds(420, 350, 220, 10);

        RB_tardeD.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup4.add(RB_tardeD);
        RB_tardeD.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_tardeD.setForeground(new java.awt.Color(255, 255, 255));
        RB_tardeD.setText("Tarde");
        RB_tardeD.setFocusPainted(false);
        RB_tardeD.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_tardeDItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_tardeD);
        RB_tardeD.setBounds(520, 310, 78, 34);

        RB_manhaD.setBackground(new java.awt.Color(0, 0, 0));
        buttonGroup4.add(RB_manhaD);
        RB_manhaD.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N
        RB_manhaD.setForeground(new java.awt.Color(255, 255, 255));
        RB_manhaD.setText("Manhã");
        RB_manhaD.setFocusPainted(false);
        RB_manhaD.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                RB_manhaDItemStateChanged(evt);
            }
        });
        jPanel1.add(RB_manhaD);
        RB_manhaD.setBounds(520, 270, 80, 34);

        serieDD.setBackground(new java.awt.Color(0, 0, 0));
        serieDD.setEditable(false);
        serieDD.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        serieDD.setForeground(new java.awt.Color(255, 255, 255));
        serieDD.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        serieDD.setText("D");
        serieDD.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 2, 2, new java.awt.Color(255, 255, 255)));
        serieDD.setCaretColor(new java.awt.Color(255, 255, 255));
        jPanel1.add(serieDD);
        serieDD.setBounds(450, 290, 40, 40);

        jB_cadastrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/OKlay1.jpg"))); // NOI18N
        jB_cadastrar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jB_cadastrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jB_cadastrarMouseClicked(evt);
            }
        });
        jPanel1.add(jB_cadastrar);
        jB_cadastrar.setBounds(350, 570, 70, 70);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/voltar.jpg"))); // NOI18N
        jLabel1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel1MouseClicked(evt);
            }
        });
        jPanel1.add(jLabel1);
        jLabel1.setBounds(580, 610, 180, 50);

        jPanel1.setBounds(0, 0, 800, 690);
        jDesktopPane1.add(jPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 781, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 671, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-797)/2, (screenSize.height-709)/2, 797, 709);
    }// </editor-fold>//GEN-END:initComponents

    private void RB_manhaAItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaAItemStateChanged
turnoA=RB_manhaA.getText();        
    }//GEN-LAST:event_RB_manhaAItemStateChanged

    private void RB_tardeAItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeAItemStateChanged
turnoA=RB_tardeA.getText(); 
    }//GEN-LAST:event_RB_tardeAItemStateChanged

    private void RB_manhaBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaBItemStateChanged
        turnoB=RB_manhaB.getText();
    }//GEN-LAST:event_RB_manhaBItemStateChanged

    private void RB_manhaGItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaGItemStateChanged
       turnoG=RB_manhaG.getText();
    }//GEN-LAST:event_RB_manhaGItemStateChanged

    private void RB_manhaHItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaHItemStateChanged
        turnoH=RB_manhaH.getText();
    }//GEN-LAST:event_RB_manhaHItemStateChanged

    private void RB_tardeGItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeGItemStateChanged
      turnoG=RB_tardeG.getText();   
    }//GEN-LAST:event_RB_tardeGItemStateChanged

    private void RB_tardeHItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeHItemStateChanged
       turnoH=RB_tardeH.getText();   
    }//GEN-LAST:event_RB_tardeHItemStateChanged

    private void jB_cadastrarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jB_cadastrarMouseClicked
if(i==0){       EstagiosTabela.id=1;
        if(buttonGroup1.getSelection()!=null){
            String a="3A";
            String b=turnoA;
            String c=serieAA.getText();
            
            EstagiosTabela.setEstagioA(a, b, c);
        }
        if(buttonGroup2.getSelection()!=null){
            String a="3B";
            String b=turnoB;
            String c=serieBB.getText();
            EstagiosTabela.setEstagioB(a, b, c);
        }
        if(buttonGroup3.getSelection()!=null){
            String a="3C";
            String b=turnoC;
            String c=serieCC.getText();
            EstagiosTabela.setEstagioC(a, b, c);
        }
        if(buttonGroup4.getSelection()!=null){
            String a="3D";
            String b=turnoD;
            String c=serieDD.getText();
            EstagiosTabela.setEstagioD(a, b, c);
        }
        if(buttonGroup5.getSelection()!=null){
            String a="3E";
            String b=turnoE;
            String c=serieEE.getText();
            EstagiosTabela.setEstagioE(a, b, c);
        }
        if(buttonGroup6.getSelection()!=null){
            String a="3F";
            String b=turnoF;
            String c=serieFF.getText();
            EstagiosTabela.setEstagioF(a, b, c);
        }
        if(buttonGroup7.getSelection()!=null){
            String a="3G";
            String b=turnoG;
            String c=serieGG.getText();
            EstagiosTabela.setEstagioF(a, b, c);
        }
        if(buttonGroup8.getSelection()!=null){
            String a="3H";
            String b=turnoH;
            String c=serieHH.getText();
            EstagiosTabela.setEstagioF(a, b, c);
        }
        VerificaQuantHA_est();
        
        
        
      }
    }//GEN-LAST:event_jB_cadastrarMouseClicked

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
       
    }//GEN-LAST:event_formWindowClosed

    private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked
        if(i==0){  
            try {
            tela.Minimiza(0);
        } catch (SQLException ex) {
            Logger.getLogger(ADDEstagios.class.getName()).log(Level.SEVERE, null, ex);
        }
         dispose();
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new ChamaLayout().setVisible(true);
            }
        });        
         i=1;
      }
    }//GEN-LAST:event_jLabel1MouseClicked

    private void RB_tardeBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeBItemStateChanged
       turnoB=RB_tardeB.getText();   
    }//GEN-LAST:event_RB_tardeBItemStateChanged

    private void RB_manhaCItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaCItemStateChanged
        turnoC=RB_manhaC.getText();     
    }//GEN-LAST:event_RB_manhaCItemStateChanged

    private void RB_tardeCItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeCItemStateChanged
       turnoC=RB_tardeC.getText();   
    }//GEN-LAST:event_RB_tardeCItemStateChanged

    private void RB_manhaDItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaDItemStateChanged
       turnoD=RB_manhaD.getText();   
    }//GEN-LAST:event_RB_manhaDItemStateChanged

    private void RB_tardeDItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeDItemStateChanged
       turnoD=RB_tardeD.getText();    
    }//GEN-LAST:event_RB_tardeDItemStateChanged

    private void RB_manhaEItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaEItemStateChanged
        turnoE=RB_manhaE.getText(); 
    }//GEN-LAST:event_RB_manhaEItemStateChanged

    private void RB_tardeEItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeEItemStateChanged
       turnoE=RB_tardeE.getText();  
    }//GEN-LAST:event_RB_tardeEItemStateChanged

    private void RB_manhaFItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_manhaFItemStateChanged
       turnoF=RB_manhaF.getText();   
    }//GEN-LAST:event_RB_manhaFItemStateChanged

    private void RB_tardeFItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_RB_tardeFItemStateChanged
       turnoF=RB_tardeF.getText(); 
    }//GEN-LAST:event_RB_tardeFItemStateChanged
                                     

  
    
                          
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
       
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new ADDEstagios().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton RB_manhaA;
    private javax.swing.JRadioButton RB_manhaB;
    private javax.swing.JRadioButton RB_manhaC;
    private javax.swing.JRadioButton RB_manhaD;
    private javax.swing.JRadioButton RB_manhaE;
    private javax.swing.JRadioButton RB_manhaF;
    private javax.swing.JRadioButton RB_manhaG;
    private javax.swing.JRadioButton RB_manhaH;
    private javax.swing.JRadioButton RB_tardeA;
    private javax.swing.JRadioButton RB_tardeB;
    private javax.swing.JRadioButton RB_tardeC;
    private javax.swing.JRadioButton RB_tardeD;
    private javax.swing.JRadioButton RB_tardeE;
    private javax.swing.JRadioButton RB_tardeF;
    private javax.swing.JRadioButton RB_tardeG;
    private javax.swing.JRadioButton RB_tardeH;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.ButtonGroup buttonGroup4;
    private javax.swing.ButtonGroup buttonGroup5;
    private javax.swing.ButtonGroup buttonGroup6;
    private javax.swing.ButtonGroup buttonGroup7;
    private javax.swing.ButtonGroup buttonGroup8;
    private javax.swing.JLabel jB_cadastrar;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator10;
    private javax.swing.JSeparator jSeparator11;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JSeparator jSeparator7;
    private javax.swing.JSeparator jSeparator8;
    private javax.swing.JSeparator jSeparator9;
    private javax.swing.JLabel jl_serie;
    private javax.swing.JLabel jl_serie1;
    private javax.swing.JLabel jl_serie2;
    private javax.swing.JTextField serieAA;
    private javax.swing.JTextField serieBB;
    private javax.swing.JTextField serieCC;
    private javax.swing.JTextField serieDD;
    private javax.swing.JTextField serieEE;
    private javax.swing.JTextField serieFF;
    private javax.swing.JTextField serieGG;
    private javax.swing.JTextField serieHH;
    private javax.swing.JTextField serieextra;
    // End of variables declaration//GEN-END:variables

    private void Desabilita() {
         RB_manhaA.setVisible(false);
        RB_manhaB.setVisible(false);
        RB_manhaC.setVisible(false);
        RB_manhaD.setVisible(false);
        RB_manhaE.setVisible(false);
        RB_manhaF.setVisible(false);
        RB_manhaG.setVisible(false);
        RB_manhaH.setVisible(false);
        RB_tardeA.setVisible(false);
        RB_tardeB.setVisible(false);
        RB_tardeC.setVisible(false);
        RB_tardeD.setVisible(false);
        RB_tardeE.setVisible(false);
        RB_tardeF.setVisible(false);
        RB_tardeG.setVisible(false);
        RB_tardeH.setVisible(false);
        serieAA.setVisible(false);
        serieBB.setVisible(false);
        serieCC.setVisible(false);
        serieDD.setVisible(false);
        serieEE.setVisible(false);
        serieFF.setVisible(false);
        serieGG.setVisible(false);
        serieHH.setVisible(false);
        jSeparator4.setVisible(false);
        jSeparator1.setVisible(false);
        jSeparator6.setVisible(false);
        jSeparator7.setVisible(false);
        jSeparator8.setVisible(false);
        jSeparator9.setVisible(false);
        jSeparator10.setVisible(false);
        jSeparator11.setVisible(false);
    }

    private void SerieTurma()  {
        SerieMet sm = new SerieMet();
        Serie s = new Serie();
        try {
            listaserie = sm.getList3();
        } catch (SQLException ex) {
            Logger.getLogger(ADDEstagios.class.getName()).log(Level.SEVERE, null, ex);
        }
        nome_turma = new String [listaserie.size()];
        int i=0;

        while(listaserie.size()>i){
        s = listaserie.get(i);
        nome_turma[i] = s.getTurma();
        System.out.println("nome: " + nome_turma[i]);
        i++;
        }
    for( i=0;listaserie.size()>i;i++){
        if( "A".equals(nome_turma[i])){
        serieextra.setVisible(true);
        serieAA.setVisible(true);
        RB_manhaA.setVisible(true);
        RB_tardeA.setVisible(true);
        jSeparator8.setVisible(true);
        }if("B".equals(nome_turma[i])){ 
        serieextra.setVisible(true);
        serieBB.setVisible(true);
        RB_manhaB.setVisible(true);
        RB_tardeB.setVisible(true);
        jSeparator9.setVisible(true);
        }if("C".equals(nome_turma[i])){
        
        serieextra.setVisible(true);
        serieCC.setVisible(true);
        RB_manhaC.setVisible(true);
        RB_tardeC.setVisible(true);
        jSeparator10.setVisible(true);
        }if("D".equals(nome_turma[i])){
        
        serieextra.setVisible(true);
        serieDD.setVisible(true);
        RB_manhaD.setVisible(true);
        RB_tardeD.setVisible(true);
        jSeparator11.setVisible(true);
        }if("E".equals(nome_turma[i])){
        serieextra.setVisible(true);
        serieEE.setVisible(true);
        RB_manhaE.setVisible(true);
        RB_tardeE.setVisible(true);
        jSeparator1.setVisible(true);
        }if("F".equals(nome_turma[i])){  
        serieextra.setVisible(true);
        serieFF.setVisible(true);
        RB_manhaF.setVisible(true);
        RB_tardeF.setVisible(true);
        jSeparator4.setVisible(true);
        }
        if("G".equals(nome_turma[i])){  
        serieextra.setVisible(true);
        serieGG.setVisible(true);
        RB_manhaG.setVisible(true);
        RB_tardeG.setVisible(true);
        jSeparator6.setVisible(true);
        }
        if("H".equals(nome_turma[i])){  
        serieextra.setVisible(true);
        serieHH.setVisible(true);
        RB_manhaH.setVisible(true);
        RB_tardeH.setVisible(true);
        jSeparator7.setVisible(true);
        }
    }
    }

    private void VerificaQuantHA_est() {
        int ha = 0;
        try {
            ha = objmet.VerificaQuatdeHA();
        } catch (SQLException ex) {
            Logger.getLogger(ADDEstagios.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        int soma=0;
        int aulaextra=0;
        if(buttonGroup1.getSelection()!=null){
            String b=turnoA;
            if("Manhã".equals(b)){
              soma=soma+25;  
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        if(buttonGroup2.getSelection()!=null){
            String b=turnoB;
            if("Manhã".equals(b)){
              soma=soma+25;  
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        if(buttonGroup3.getSelection()!=null){
            String b=turnoC;
            if("Manhã".equals(b)){
              soma=soma+25;  
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        if(buttonGroup4.getSelection()!=null){
            String b=turnoD;
            if("Manhã".equals(b)){
              soma=soma+25; 
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        if(buttonGroup5.getSelection()!=null){
            String b=turnoE;
            if("Manhã".equals(b)){
              soma=soma+25;  
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        if(buttonGroup6.getSelection()!=null){
            String b=turnoF;
            if("Manhã".equals(b)){
              soma=soma+25;  
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        if(buttonGroup7.getSelection()!=null){
            String b=turnoG;
            if("Manhã".equals(b)){
              soma=soma+25;  
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        if(buttonGroup8.getSelection()!=null){
            String b=turnoH;
            if("Manhã".equals(b)){
              soma=soma+25;  
              aulaextra=aulaextra+1;
            }else{
              soma=soma+20;  
            }
        }
        int HAObrigatoria=0;
        int j;
        j=seriemet.BuscarQuantdeSerie();
        int aulas=(45*j)+(aulaextra*5);
        HAObrigatoria=aulas-soma;
        if(HAObrigatoria==ha){
            dispose();
          if("Manhã".equals(turnoA) || "Manhã".equals(turnoB) || "Manhã".equals(turnoC) || "Manhã".equals(turnoD)|| "Manhã".equals(turnoE)|| "Manhã".equals(turnoF)|| "Manhã".equals(turnoG)|| "Manhã".equals(turnoH)){
          java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new aula10().setVisible(true);
            }
        });  
        }else{
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new Aguarde().setVisible(true);
            }
        });
        }
        i=1;
        }else if(HAObrigatoria>ha){
            int sub=HAObrigatoria-ha;
            JOptionPane.showMessageDialog(null, "Retorne a tela de Hora Aula e adicione mais "+sub+" horas aula");
        }else{
         int sm=ha-HAObrigatoria;
            JOptionPane.showMessageDialog(null, "Retorne a tela de Hora Aula e delete "+sm+" horas aula");
           
        }
    }
}
